package cz.proks.easyhelpdesk.gae.core.ws;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import cz.proks.easyhelpdesk.api.OAuth2TokenApi;
import cz.proks.easyhelpdesk.api.config.Configuration;
import cz.proks.easyhelpdesk.api.exception.ApiException;
import cz.proks.easyhelpdesk.api.model.OAuth2Token;
import cz.proks.easyhelpdesk.gae.core.manager.OAuth2TokenManager;

@Component(Configuration.Core.WS.OAUTH2_TOKEN_API)
public class OAuth2TokenApiImpl extends BaseApiImpl<OAuth2Token> implements OAuth2TokenApi {
    private final Logger log = LoggerFactory.getLogger(getClass());

    @Autowired
    private OAuth2TokenManager manager;
    
    @Override
    protected OAuth2TokenManager getManager() {
        return manager;
    }

    @Override
    public void deleteAllForProviderId(String providerId) throws ApiException {
        log.debug("deleteAllForProviderId():: Start with providerId '{}'", providerId);
        
        manager.deleteAllForProviderId(providerId);
        
        log.debug("deleteAllForProviderId():: Exit"); 
    }       
}
